package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import com.atguigu.springcloud.service.PaymentFeginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderFeiginController {

    @Resource
    private PaymentFeginService paymentFeginService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPaymentId(@PathVariable("id")Long id){
        return paymentFeginService.getPaymentId(id);
    }

    @GetMapping("/consumer/feign/timeout")
    public String paymentFeiginTimeout(){
        //openfeign-ribbon客户端默认一般等待一秒
        return paymentFeginService.paymentFeiginTimeout();
    }
}
